﻿using System;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using SLSocketServer.LotteryWCF;
namespace SLSocketServer
{
    public class WcfProxy
    {
        public WcfProxy(){}
        public static LotteryServiceClient GetProxy
        {
            get
            {
                string url = "http://localhost:3397/LotteryService.svc";
                EndpointAddress address = new EndpointAddress(url);
                BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
                binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
                binding.SendTimeout = new TimeSpan(0, 10, 0);
                binding.MaxReceivedMessageSize = 2147483647;
                binding.OpenTimeout = new TimeSpan(0, 10, 0);
                binding.CloseTimeout = new TimeSpan(0, 10, 0);
                LotteryServiceClient client = new LotteryServiceClient(binding, address);
                EndpointBehavior endpointBehavior = new EndpointBehavior();
                client.Endpoint.Behaviors.Add(endpointBehavior);
                return client;
            }
        }
    }
}
